package test1014;

import java.util.Scanner;

public class Person {
    private String name;
    private int age;
    private String gender;
    private String education;
    private String birthDate;
    private String position;
    private String phoneNumber;
    private String address;

    public void setValuesFromConsole() {
        Scanner scanner = new Scanner(System.in);

        System.out.print("姓名: ");
        name = scanner.nextLine();

        System.out.print("年龄: ");
        age = scanner.nextInt();
        scanner.nextLine(); // 消耗掉输入缓冲区中的换行符

        System.out.print("性别: ");
        gender = scanner.nextLine();

        System.out.print("学历: ");
        education = scanner.nextLine();

        System.out.print("出生日期: ");
        birthDate = scanner.nextLine();

        System.out.print("职务: ");
        position = scanner.nextLine();

        System.out.print("联系电话: ");
        phoneNumber = scanner.nextLine();

        System.out.print("家庭地址: ");
        address = scanner.nextLine();
    }

    public void displayInfo() {
        System.out.println("姓名: " + name);
        System.out.println("年龄: " + age);
        System.out.println("性别: " + gender);
        System.out.println("学历: " + education);
        System.out.println("出生日期: " + birthDate);
        System.out.println("职务: " + position);
        System.out.println("联系电话: " + phoneNumber);
        System.out.println("家庭地址: " + address);
    }

    public static void main(String[] args) {
        Person person = new Person();
        person.setValuesFromConsole();
        System.out.println("\n人员信息:");
        person.displayInfo();
    }
}


